home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / memory / src / freeentry.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-16  |  1.3 KB  |  64 lines

  1. /*
  2.     (C) 1995 AROS - The Amiga Replacement OS
  3.     $Id: freeentry.c 1.1 1995/11/14 22:31:07 digulla Exp digulla $
  4.     $Log: freeentry.c $
  5.  * Revision 1.1  1995/11/14  22:31:07  digulla
  6.  * Initial revision
  7.  *
  8.     Desc:
  9.     Lang: english
  10. */
  11. #include "exec_intern.h"
  12.  
  13. /*****************************************************************************
  14.  
  15.     NAME */
  16.     #include <exec/memory.h>
  17.     #include <clib/exec_protos.h>
  18.  
  19.     __AROS_LH1(void, FreeEntry,
  20.  
  21. /*  SYNOPSIS */
  22.     __AROS_LA(struct MemList *, entry, A0),
  23.  
  24. /*  LOCATION */
  25.     struct ExecBase *, SysBase, 38, Exec)
  26.  
  27. /*  FUNCTION
  28.     Free some memory allocated with AllocEntry().
  29.  
  30.     INPUTS
  31.     entry - The MemList you got from AllocEntry().
  32.  
  33.     RESULT
  34.  
  35.     NOTES
  36.  
  37.     EXAMPLE
  38.  
  39.     BUGS
  40.  
  41.     SEE ALSO
  42.     AllocEntry()
  43.  
  44.     INTERNALS
  45.  
  46.     HISTORY
  47.     18-10-95    created by m. fleischer
  48.     26-10-95    digulla adjusted to new calling scheme
  49.  
  50. ******************************************************************************/
  51. {
  52.     __AROS_FUNC_INIT
  53.     ULONG i;
  54.  
  55.     /* First free all blocks in the MemList */
  56.     for (i=0; i<entry->ml_NumEntries; i++)
  57.     FreeMem (entry->ml_ME[i].me_Addr, entry->ml_ME[i].me_Length);
  58.  
  59.     /* Then free the MemList itself */
  60.     FreeMem (entry, sizeof (struct MemList) - sizeof (struct MemEntry)
  61.           + sizeof (struct MemEntry) * entry->ml_NumEntries);
  62.     __AROS_FUNC_EXIT
  63. } /* FreeEntry */
  64.